#Include <ScreenCapture.au3>
#Include <Function For Backup and Restore.au3>

Common_WriteCurrentFunctionNameToTempTXT($sBackupRestoreFunctionName)

BackupAndRestore1_1_1()
BackupAndRestore1_2_4()
BackupAndRestore1_2_5()
BackupAndRestore1_2_6()
BackupAndRestore2_1_2()
BackupAndRestore2_1_3()
BackupAndRestore2_1_4()
BackupAndRestore2_1_5()
If Not $bPageViewType Then 
	BackupAndRestore2_1_6()
EndIf
BackupAndRestore2_1_15()
BackupAndRestore2_1_18()
BackupAndRestore2_1_21()
BackupAndRestore2_1_23()
BackupAndRestore2_1_24()
BackupAndRestore2_1_25()
BackupAndRestore2_1_42()
BackupAndRestore2_1_43()
BackupAndRestore2_1_45()
BackupAndRestore2_1_46()
BackupAndRestore2_1_49()
BackupAndRestore2_1_50()
BackupAndRestore2_1_52()
BackupAndRestore2_2_1()
BackupAndRestore2_2_17()
BackupAndRestore2_2_22()
BackupAndRestore2_2_24()
BackupAndRestore2_2_26()
BackupAndRestore2_2_29()
BackupAndRestore2_2_30()

CloseOpenedExcel($oExcel)
Func BackupAndRestore1_1_1()
	Local $TestCaseID = "1.1.1"  
	$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	FileCopy($sSampleFolderPath & 'JPG.jpg', $sFunctionFolderPath, 1)
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	Common_SleepTime(1)	
	_GUICtrlListView_ClickItem($hThumbnailView, 0, "left") 
	Common_SleepTime(1)	
	OpenMenu("File")
	Local $hMenu = WinGetHandle($sMenuCtrInfo)
	Common_ScreenCaprureWindow($sTestResultPath,$sCaptureImage,$hMenu)
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  			
	If $bCompareFile Then	
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	EndIf
	Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)    
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore1_2_4()
	Local $TestCaseID = "1.2.4" 
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	Common_SleepTime(1)	
	OpenMenu("File")
	Local $hMenu = WinGetHandle($sMenuCtrInfo)
	Common_ScreenCaprureWindow($sTestResultPath, $sCaptureImage,$hMenu)
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  			
	If $bCompareFile Then	
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	EndIf
	Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)    
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore1_2_5()
	Local $TestCaseID = "1.2.5"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	Common_SleepTime(1)	
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	ControlFocus($CommonWindowCtrlInfro, "", 1055)
	Sleep(300)
	Common_ScreenCaprureWindow($sTestResultPath, $sCaptureImage,WinGetHandle(''))
	Send('{ESC}')
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  			
	If $bCompareFile Then	
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	EndIf
	
	Send('{ESC}')
	Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)    
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore1_2_6()
	Local $TestCaseID = "1.2.6"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	Common_SleepTime(1)	
	OpenRestoreSettingDlg()
	Common_ScreenCaprureWindow($sTestResultPath, $sCaptureImage,WinGetHandle(''))
	Send('{ESC}')
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  			
	If $bCompareFile Then	
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	EndIf
	Send('{ESC}')
	Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)    
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_2()
	Local $TestCaseID = "2.1.2"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	If Not SetBackupDestination() Then
		Common_WriteLog($sFaile & $sFailLogMsg, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 0
	EndIf
	ClickOKOnBackupSettings()
	SwitchToRestoreFolder($hPMHandle)
	OpenRestoreSettingDlg()
	SelectRestoreSource($TestCaseID)
	ClickOKOnRestoreSettings()
	Local $FoderList = _FileListToArray($sRestoreFileFolderPath & "Sample\")
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf $FoderList[0] = 8 Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_3()
	Local $TestCaseID = "2.1.3"
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	_GUICtrlListView_ClickItem($hThumbnailView, 0, "right")
	Common_SleepTime(2)
	Send("e")
	Common_SleepTime(1)
	AddAuthor($TestCaseID)
	AddKeyword($TestCaseID)	
	; Add memo
	ControlFocus($CommonWindowCtrlInfro, "", 1023)
	ControlSetText($CommonWindowCtrlInfro, "", 1023, $TestCaseID)
	Common_SleepTime(1)	
	ControlClick($CommonWindowCtrlInfro, "", 1)
	Common_SleepTime(1)	
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	Local $FoderList = DirGetSize($sTestResultPath & $TestCaseID)
	If @error Then
		Common_WriteLog($sFaile&$sFailLogMsg ,$TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_4()
	Local $TestCaseID = "2.1.4" 
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	_GUICtrlListView_ClickItem($hThumbnailView, 0, "right")
	Common_SleepTime(2)
	Send("e")
	Common_SleepTime(1)	
	SetFileReadonly()
	Common_SleepTime(1)	
	ControlClick($CommonWindowCtrlInfro, "", 1)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	Local $FoderList = DirGetSize($sTestResultPath & $TestCaseID)
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_5()
	Local $TestCaseID = "2.1.5" 
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf	
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	_GUICtrlListView_ClickItem($hThumbnailView, 0)
	Common_SleepTime(1)
	ControlListView($hPMHandle, "", $sThumbnailViewCtrInfo, "Select" ,1,2)
	Common_SleepTime(1)
	ControlClick($hPMHandle, "", $sStackButtonInToolbarCtrInfo)
	Common_SleepTime(1)		
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	Local $FoderList = DirGetSize($sTestResultPath & $TestCaseID)
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_6()
	Local $TestCaseID = "2.1.6"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	Common_SleepTime(10)	
	Local $hThumbnailView = ControlGetHandle($hPMHandle, "", $sThumbnailViewCtrInfo)
	_GUICtrlListView_ClickItem($hThumbnailView, 0)
	Common_SleepTime(1)
	ControlClick($hPMHandle, "", $sPageViewButtonInToolbarCtrInfo)   ;Click page view button.
	Common_SleepTime(15)
	If $bPageViewType = 1 Then
		If Not Common_AddTextAnnotation() Then
			Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)
			Common_Close_PM($hPMHandle) 
			Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
			Return 0
		EndIf
	Else
		;Add stamp annotation in page view.
		Local $sReturn = Common_ControlGetPos($hPMHandle, "", $sAnnotationBarCtrlInfo)
		MouseMove($sReturn[0] + $sReturn[2]/2,$sReturn[1] + $sReturn[3]/4.2)
		Common_SleepTime(1)
		MouseClick('left',$sReturn[0] + $sReturn[2]/2,$sReturn[1] + $sReturn[3]/4.2)
		Send('{DOWN}')
		Common_SleepTime(1)
		Send('{ENTER}')
		Local $sReturn = Common_ControlGetPos($hPMHandle, "", $sThumbnailViewCtrInfo)
		MouseClick('left', $sReturn[0] + $sReturn[2]/3.6, $sReturn[1] + $sReturn[3]/2.6)
		Common_SleepTime(2)
		ControlClick($hPMHandle, "", $sSwicthToThumbnailViewButtonCtrInfo)   ;Click thumbnail button.
		Send('{ENTER}')   ;Save anonotaton.
	EndIf
	Common_SleepTime(4)	
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	Local $FoderList = DirGetSize($sTestResultPath & $TestCaseID)
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_15()
	Local $TestCaseID = "2.1.15"
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	Common_SleepTime(4)
	_GUICtrlTreeView_ClickItem(ControlGetHandle($hPMHandle, "", $sTreeViewCtrInfo), _GUICtrlTreeView_FindItem(ControlGetHandle($hPMHandle, "", $sTreeViewCtrInfo), "Sample"),"Right")
	Send("h")
	WinWaitActive($CommonWindowCtrlInfro, "", 5)
	Common_SleepTime(2)
	ControlClick($CommonWindowCtrlInfro, "", 6005)
	Common_SleepTime(1)
	ControlClick($CommonWindowCtrlInfro, "", 1)
	Common_SleepTime(2)
	Send("{ENTER}")
	Common_SleepTime(3)
	Send("{ENTER}")
	Common_SleepTime(3)	
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	_GUICtrlTreeView_ClickItem(ControlGetHandle($hPMHandle, "", $sTreeViewCtrInfo), _GUICtrlTreeView_FindItem(ControlGetHandle($hPMHandle, "", $sTreeViewCtrInfo), "Sample"),"Right")
	Send("h")
	WinWaitActive($CommonWindowCtrlInfro, "", 5)
	Common_SleepTime(2)
	ControlClick($CommonWindowCtrlInfro, "", 6004)
	Common_SleepTime(1)
	ControlClick($CommonWindowCtrlInfro, "", 1)
	Common_SleepTime(2)
	Send("{ENTER}")
	Common_SleepTime(3)
	Send("{ENTER}")
	Common_SleepTime(3)
	Local $FoderList = DirGetSize($sTestResultPath & $TestCaseID)
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_18()
	Local $TestCaseID = "2.1.18" 
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	Local $FoderList = DirGetSize($sTestResultPath & $TestCaseID)
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_21()
	Local $TestCaseID = "2.1.21"
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $longFolderName = "\a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
	DirRemove(@MyDocumentsDir & $longFolderName,1)
	DirCreate(@MyDocumentsDir & $longFolderName) 
	DirCopy ($sSampleFolderPath, @MyDocumentsDir & $longFolderName,1)
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Local $hTree = ControlGetHandle($hPMHandle, "", $sTreeViewCtrInfo)
	Local $hItemFound = _GUICtrlTreeView_FindItem($hTree, @UserName)
	_GUICtrlTreeView_Expand($hTree,$hItemFound)
	Local $hItemFound = _GUICtrlTreeView_FindItem($hTree, "a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
	_GUICtrlTreeView_ClickItem($hTree, $hItemFound)
	Common_SleepTime(6)		
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	DirRemove(@MyDocumentsDir & $longFolderName,1)
	Local $FoderList = DirGetSize($sTestResultPath & $TestCaseID)
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_23()
	Local $TestCaseID = "2.1.23"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	Local $FoderList = DirGetSize($sTestResultPath & $TestCaseID)
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_24()
	Local $TestCaseID = "2.1.24"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	DirRemove(@MyDocumentsDir & "\1",1)
	DirCreate(@MyDocumentsDir & "\1") 
	DirCreate(@MyDocumentsDir & "\1\2" ) 
	DirCopy ($sSampleFolderPath, @MyDocumentsDir & "\1\2",1)
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Local $hTree = ControlGetHandle($hPMHandle, "", $sTreeViewCtrInfo)
	Local $hItemFound = _GUICtrlTreeView_FindItem($hTree, @UserName)
	_GUICtrlTreeView_Expand($hTree,$hItemFound)
	Local $hItemFound = _GUICtrlTreeView_FindItem($hTree, '1')
	_GUICtrlTreeView_ClickItem($hTree, $hItemFound)
	Common_SleepTime(6)		
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	DirRemove(@MyDocumentsDir & "\1",1)
	Local $FoderList = DirGetSize($sTestResultPath & $TestCaseID)
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_25()
	Local $TestCaseID = "2.1.25"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	FileCopy($COMMON_SAMPLES_FOLDER_PATH & 'SinglePageTextProtect.PDF', $PMFolder, 1)
	Send('{F5}')
	Local $hTreeView=ControlGetHandle($hPMHandle,"",$sTreeViewCtrInfo)
	Common_SleepTime(2) 
	Local $hPM=_GUICtrlTreeView_GetSelection($hTreeView)
	Common_SleepTime(2) 
	Local $hItemFound = _GUICtrlTreeView_FindItem($hTreeView, $sMyPageManagerSampleFolder)
	Common_SleepTime(2)
	_GUICtrlTreeView_ClickItem($hTreeView,$hItemFound,"left")
	Common_SleepTime(2)	
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	;select My PageManager
	ControlClick($CommonWindowCtrlInfro, "", 1022)
	Common_SleepTime(6)	
	Local $hTree = ControlGetHandle($CommonWindowCtrlInfro, "", 100)
	Local $hItemFound1 = _GUICtrlTreeView_FindItem($hTree, @UserName)
	_GUICtrlTreeView_Expand($hTree,$hItemFound1,False)
	Sleep(300)
	Local $hItemFound2 = _GUICtrlTreeView_FindItem($hTree, 'My Documents')
	If $hItemFound2 == 0 Then $hItemFound2 = _GUICtrlTreeView_FindItem($hTreeView, 'Documents')
	_GUICtrlTreeView_Expand($hTree,$hItemFound2)	
	Sleep(300)
	Local $hItemFound3 = _GUICtrlTreeView_FindItem($hTree, $sMyPageManagerSampleFolder)
	_GUICtrlTreeView_ClickItem($hTree, $hItemFound3)	
	Sleep(300)
	ControlClick($CommonWindowCtrlInfro,'',1)
	Common_SleepTime(2)
	
	If WinExists($sAllMessageTitle) Then
		Common_ScreenCaprureWindow($sTestResultPath,$sCaptureImage, $sAllMessageTitle)
		Common_SleepTime(2) 
		Send("{enter}")
		Local $CaptureCompareResult = Common_CompareFile ($sTestResultPath&$sCaptureImage, $sCorrectResultPath&$sCaptureImage)  
		Common_SleepTime(2)
		If $CaptureCompareResult Then			
			Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase) 
			Common_Close_PM($hPMHandle) 
			Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
			Return 1   
		Else
			Common_WriteLog($sFaile &$sFailLogMsg, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
			Common_Close_PM($hPMHandle) 
			Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
			Return 0
		EndIf
	Else
		Common_WriteLog($sFaile & $sFailLogMsg, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_42()
	Local $TestCaseID = "2.1.42"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel("2.  42")
	SetBuckupName("2.  42")
	SetBackupDestination()
	ClickOKOnBackupSettings()
	Local $FoderList = DirGetSize($sTestResultPath & "2.  42")
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_43()
	Local $TestCaseID = "2.1.43"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName("2.1.43   ")
	SetBackupDestination()
	ClickOKOnBackupSettings()
	Local $FoderList = DirGetSize($sTestResultPath & $TestCaseID)
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_45()
	Local $TestCaseID = "2.1.45"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName("0123456789012345678901234567890123456789123")
	SetBackupDestination()
	ClickOKOnBackupSettings()
	Local $FoderList = DirGetSize($sTestResultPath & "0123456789012345678901234567890123456789123")
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_46()
	Local $TestCaseID = "2.1.46"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName("2.1.18")
	SetBackupDestination()
	ControlClick($CommonWindowCtrlInfro, "", 1)   ; OK Button.
	Common_SleepTime(4)
	Common_ScreenCaprureWindow($sTestResultPath, $sCaptureImage,WinGetHandle(''))
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  			
	If $bCompareFile Then	
		Send('{ESC}')
		Send('{ESC}')
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	EndIf
	Send('{ESC}')
	Send('{ESC}')
	Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)    
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0 
EndFunc

Func BackupAndRestore2_1_49()
	Local $TestCaseID = "2.1.49"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetPassword('01234567890123456789012345678901','01234567890123456789012345678901')
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	Local $FoderList = DirGetSize($sTestResultPath & $TestCaseID)
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_50()
	Local $TestCaseID = "2.1.50"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetPassword('?)(*&^%$#@!~`','?)(*&^%$#@!~`')
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	Local $FoderList = DirGetSize($sTestResultPath & $TestCaseID)
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_1_52()
	Local $TestCaseID = "2.1.52"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetPassword('1  2','1  2')
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	Local $FoderList = DirGetSize($sTestResultPath & $TestCaseID)
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_2_1()
	Local $TestCaseID = "2.2.1"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	SwitchToTestFolder($hPMHandle)
	OpenRestoreSettingDlg()
	SelectRestoreSource($TestCaseID)
	ClickOKOnRestoreSettings()	
	Local $FoderList = DirGetSize($sTestFolderPath & "Sample")
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_2_5()
	Local $TestCaseID = "2.2.5"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	SwitchToTestFolder($hPMHandle)
	OpenRestoreSettingDlg()
	SelectRestoreSource($TestCaseID)
	ClickOKOnRestoreSettings()	
	Local $FoderList = DirGetSize($sTestFolderPath & "Sample")
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_2_17()
	Local $TestCaseID = "2.2.17"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	Local $hTree = ControlGetHandle($hPMHandle, "", $sTreeViewCtrInfo)
	Local $hItemFound1 = _GUICtrlTreeView_FindItem($hTree, $sDiskC_DiskVolumeName)
	_GUICtrlTreeView_ClickItem($hTree, $hItemFound1)	
	Common_SleepTime()
	local $posPM = WinGetPos($hPMHandle)	
	MouseClick("left",$posPM[0]+$posPM[2]/2,$posPM[1])
	Common_SleepTime()	
	OpenRestoreSettingDlg()
	SelectRestoreSource($TestCaseID)
	ClickOKOnRestoreSettings()	
	Local $FoderList = DirGetSize('C:\Sample')
	DirRemove('C:\Sample',1)
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_2_22()
	Local $TestCaseID = "2.2.22"  
		$sCusMsg = 'The image is password window'
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetPassword('1','1')
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	SwitchToTestFolder($hPMHandle)
	OpenRestoreSettingDlg()
	SelectRestoreSource($TestCaseID)
	ControlClick($CommonWindowCtrlInfro,'',1)
	Common_SleepTime(3)
	Send("{ENTER}")
	Common_SleepTime(3)
	Common_ScreenCaprureWindow($sTestResultPath, $sCaptureImage,WinGetHandle(''))
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  			
	If $bCompareFile Then	
		Send('{ESC}')
		Send('{ESC}')
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	EndIf
	Send('{ESC}')
	Send('{ESC}')
	Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)    
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0 
EndFunc

Func BackupAndRestore2_2_24()
	Local $TestCaseID = "2.2.24"  
		$sCusMsg = 'The alert message about restore failed'
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetPassword('1','1')
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	SwitchToTestFolder($hPMHandle)
	OpenRestoreSettingDlg()
	SelectRestoreSource($TestCaseID)
	ControlClick($CommonWindowCtrlInfro,'',1)
	Common_SleepTime(2)
	Send("{ENTER}")
	Common_SleepTime(2)
	Send("{ENTER}")
	Common_SleepTime(2)
	Send("{ENTER}")
	Common_SleepTime(2)
	Common_ScreenCaprureWindow($sTestResultPath, $sCaptureImage,WinGetHandle(''))
	Local $bCompareFile = Common_CompareFile($sTestResultPath & $sCaptureImage, $sCorrectResultPath & $sCaptureImage)  			
	If $bCompareFile Then	
		Send('{ESC}')
		Send('{ESC}')
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
		Return 1   
	EndIf
	Send('{ESC}')
	Send('{ESC}')
	Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)    
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0 
EndFunc

Func BackupAndRestore2_2_26()
	Local $TestCaseID = "2.2.26"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetPassword('1','1')
	SetBuckupLabel($TestCaseID)
	SetBuckupName($TestCaseID)
	SetBackupDestination()
	ClickOKOnBackupSettings()
	SwitchToTestFolder($hPMHandle)
	OpenRestoreSettingDlg()
	SelectRestoreSource($TestCaseID)
	ControlClick($CommonWindowCtrlInfro,'',1)
	Common_SleepTime(2)
	ControlSetText($CommonWindowCtrlInfro,'',1051,'1')
	Common_SleepTime(1)
	Send("{ENTER}")
	Common_SleepTime(6)
	WinWaitActive($CommonWindowCtrlInfro, "Restore complete.", 10)
	Sleep(800)
	Send("{ENTER}")
	Sleep(500)	
	Local $FoderList = DirGetSize($sTestFolderPath & "Sample")
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_2_29()
	Local $TestCaseID = "2.2.29"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName('!@#(){}$$$$')
	SetBackupDestination()
	ClickOKOnBackupSettings()
	SwitchToTestFolder($hPMHandle)
	OpenRestoreSettingDlg()
	SelectRestoreSource('!@#(){}$$$$')
	ClickOKOnRestoreSettings()	
	Local $FoderList = DirGetSize($sTestFolderPath & "Sample")
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc

Func BackupAndRestore2_2_30()
	Local $TestCaseID = "2.2.30"  
		$sCusMsg = ''
	$sFailLogMsg = Common_GetTestStepInSTD($sExcelSheetName,$iCurrentSheetTotalLineNumber,$TestCaseID, $iRescolumn, $sCusMsg)
	Local $bReproduceTestCase = Common_ReproduceRunWithIni($sBackupRestoreFunctionName,$TestCaseID)
	If $bReproduceTestCase = False Then
		Return 3   
	EndIf
	Local $sTestCaseLevel = Common_GetTestCaseLevel($oExcel, $TestCaseID,$sBackupRestoreFunctionName,$iCurrentSheetTotalLineNumber)   
	Local $bExecuteTestCase = Common_IsTestCaseLevelQualified($sTestCaseLevel)
	If $bExecuteTestCase = False Then
		Return 2   
	EndIf 
	Local $sCaptureImage = $TestCaseID & '.jpg'  
	Common_Del_DB() 
	Common_InitializeStatus()   
	InitializeStatusForBackupAndRestore()
	Local $hPMHandle = Common_Run_PageManager_Ex($TestCaseID, $sTreeViewFunctionName)
	Common_SwitchToFolderInRootDiskC($hPMHandle,$sSectionBackupRestore)
	SwitchToSampleFolder($hPMHandle)
	OpenBackupSettingDlg()
	SetBuckupLabel($TestCaseID)
	SetBuckupName('testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest')
	SetBackupDestination()
	ClickOKOnBackupSettings()
	SwitchToTestFolder($hPMHandle)
	OpenRestoreSettingDlg()
	SelectRestoreSource('testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest')
	ClickOKOnRestoreSettings()	
	Local $FoderList = DirGetSize($sTestFolderPath & "Sample")
	If @error Then
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	ElseIf (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) - 500) < $FoderList < (Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) + 500)Then
	;ElseIf $FoderList = Number(ReadIniKeyValue($sPCodeIniPath, $sSectionBackupRestore,$TestCaseID)) Then
		Common_WriteLog($sPass, $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)   
		Common_Close_PM($hPMHandle) 
		Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)	
		Return 1
	Else
		Common_WriteLog($sFaile & $sFailLogMsg , $TestCaseID,$sBackupRestoreFunctionName,$bReproduceTestCase)  
	EndIf
	Common_Close_PM($hPMHandle) 
	Common_WiteTestCaseExecuteRecode($sTempTXTPath,$TestCaseID)
	Return 0
EndFunc
